#pragma once
#pragma comment(lib, "shlwapi.lib")

#define _CRT_SECURE_NO_WARNINGS
#define XP_WIN

#include <windows.h>
#include <stdio.h>
#include <shlwapi.h>
#include <ctime>
#include <math.h>
#include <direct.h>
#include <stdlib.h>
#include <errno.h>
#include <io.h>
#include <string.h>
#include <Tlhelp32.h>

class ScriptData;

#define ArraySize(x) (sizeof(x) / sizeof(x[0]))
#define KEYDOWN(vk_code)				((GetAsyncKeyState(vk_code)&0x8000)?1:0)

#define STACK_CHUNK_SIZE    0x10000

typedef struct _THREAD_BASIC_INFORMATION {
	ULONG ExitStatus;
	PVOID TebBaseAddress;
	ULONG UniqueProcessId;
	ULONG UniqueThreadId;
	KAFFINITY AffinityMask;
	ULONG _1;
	ULONG _2;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;

typedef enum _THREAD_INFORMATION_CLASS
{
    ThreadBasicInformation = 0,
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;

typedef struct TEB {
	
} *PTEB;

struct Vars_t
{
	HINSTANCE hDLL;
	CHAR szPath[MAX_PATH];

	BOOL bAbortScripts;
	LPVOID lpW3TLSEntry;

	CRITICAL_SECTION	cTEB;
	CRITICAL_SECTION	cScriptSection;
	CRITICAL_SECTION	cCmdUnitSection;
};

extern DWORD dwRecentScriptId;
extern Vars_t Vars;

#include "ArrayEx.h"
#include "js32\jsapi.h"
#include "Constants.h"
#include "Offset.h"
#include "WC3Ptrs.h"
#include "W3Helpers.h"
#include "cMultiboard.h"
#include "Interceptions.h"
#include "Handlers.h"
#include "Helpers.h"
#include "ScriptData.h"
#include "Spidermonkey.h"
#include "CriticalSection.h"

#include "Core.h"
#include "Player.h"
#include "Unit.h"
#include "Script.h"
#include "JSCore.h"
#include "JSFile.h"
#include "JSPlayer.h"
#include "JSUnit.h"
#include "JSEvents.h"
#include "JSMultiboard.h"